package 反转链表;

public class Solution3 {
    // 递归
    public ListNode reverseList1(ListNode pre, ListNode post) {

        if (post != null) {
            ListNode temp = post.next;
            post.next = pre;
            return reverseList1(post, temp);
        }
        return pre;
    }


    public ListNode reverseList(ListNode head) {
        return reverseList1(null, head);
    }
}
